package edu.tamu.cse.teamproject1.Database.Interfaces;

import java.util.List;

/**
 * Interface for DatabaseTable Container
 * 
 * This interface defines the minimal public methods necessary of the DatabaseTable
 * class. The DatabaseTable class is a container for ColumnDefinitions and Tuples. 
 * See {@link DatabaseTable} for further details on a DatabaseTable. 
 * 
 * @author Christopher Weldon <chris@chrisweldon.net>
 * @since Release 0.1.0
 */
public interface IDatabaseTable extends Cloneable {
	/**
	 * Retrieves all column definitions for the database table
	 * 
	 * @return Column definitions for table
	 */
	List<IColumnDefinition> getColumnLists();
	
	/**
	 * Retrieves all tuples from the database table
	 * 
	 * @return List of tuples from the database
	 */
	List<ITuple> getAllTuples();
	
	/**
	 * Retrieves the table name
	 * 
	 * @return The table name
	 */
	String getName();
	
	/**
	 * Sets the table name
	 * 
	 * @param name
	 */
	void setName(String name);
	
	/**
	 * Inserts a new tuple
	 * 
	 * @param tuple
	 */
	void addTuple(ITuple tuple);
	
	/**
	 * Deletes a tuple from the table
	 * 
	 * @param tuple
	 */
	void deleteTuple(ITuple tuple);
	
	/**
	 * Adds a new column to the list of available columns
	 * 
	 * @param columnDef
	 */
	void addColumn(IColumnDefinition columnDef);
	
	/**
	 * Deletes a column based on it's columnName
	 * 
	 * @param columnName
	 */
	void deleteColumn(String columnName);
	
	/**
	 * Clears/Removes all tuples from the table
	 */
	void clearTuples();

    /**
     * retrieve all the columnNames to be displayed in a JTable
     * @param tableName
     * @return a string array of the IColumnDefinition names from the table
     */
    String[] getTableColumnNames();
    
    /**
     * retrieve all the tuples and there elements to be displayed in a JTable
     * @param tableName
     * @return a 2D array of the tuple values from the table
     */
    Object[][] getTableTuples();
	
    /**
     * Sets a status indicator whether or not this table is a view
     * 
     * @param isView
     */
    void setIsView(boolean isView);
}
